import 'package:flutter/material.dart';

import '../../db/DatabaseHelper.dart';
import '../../MyApp.dart';
import '../home_page/MainPage.dart';
import '../home_page/MainSelectPages.dart';

class Splash extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    DatabaseHelper()
        .init("one.db")
        .then((value) => {
              // var firstLevelCategory = FirstLevelCategory(name: "xcxcx");
              // DatabaseHelper().insert(FirstLevelCategory(name: "xcxcx"))
              print("value")
            })
        .catchError((err) => {print("catchError$err")})
        .whenComplete(() => {
              //延时执行的代码
              print("1秒后执行"),
              Navigator.of(context).push(MaterialPageRoute(
                  builder: (context) => const MainSelectPages()))
            });

    return const Scaffold(
        body: Center(
      child: InkWell(
        child: Text(
          "welcome",
          style: TextStyle(fontSize: 50),
        ),
      ),
    ));
  }
}
